<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>复合选择器</title>
    <style>
        span>p,
        div p {
            color: red;
        }

        h4,
        p {
            color: green;
        }
    </style>
</head>

<body>
    <div>
        <p>1测试</p>
        <p>2测试</p>
        <p>3测试</p>
        <h4>h4标题</h4>
    </div>
    <span>
        <p>这是span里面的P</p>
    </span>
    <p>这是外面的p</p>
</body>

</html>